<template>
  <div class="list">
    <div class="box" v-for="(box, index) in 100" :key="box">
      <div class="avatar">图片</div>
      <div :class="['box_right', { 'no-border': isLastBox(index) }]">
        <div class="right_main">
          <div class="username">username</div>
          <div class="last_msg">最新消息</div>
        </div>
        <div class="icon">图标</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

const isLastBox = (index: number) => {
  return index === 99; // 最后一个元素的索引是 99
};
</script>
<style scoped lang="less">
.box {
  padding: 5px 0 0 0;
  display: flex;
  align-items: center;
  height: 65px;
  cursor: pointer;

  .avatar {
    width: 65px;
    height: 65px;
  }
  .box_right {
    flex: 1;
    display: flex;
    justify-content: space-between;
    padding-left: 5px;
    height: 65px;
    border-bottom: 1px solid;

    .right_main {
      display: flex;
      flex-direction: column;
      justify-content: space-around;
    }
    .icon {
      line-height: 65px;
    }
    &.no-border {
      border-bottom: none;
    }
  }
  &:hover {
    background-color: skyblue;
    color: white;
  }
  //   list .box:last-child .box_right {
  //     border-bottom: unset;
  //   }
  //   .list .box:last-of-type .box_right {
  //     /* 在这里添加你想要的样式 */
  //     border-bottom: unset;
  //   }
}
</style>
